package cn.zhangyong.opengl20learn.baselearn1;

import android.opengl.GLES20;
import android.opengl.GLSurfaceView;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import cn.zhangyong.opengl20learn.baselearn1.shape.Square;
import cn.zhangyong.opengl20learn.baselearn1.shape.Triangle;

/**
 * 作者：<a href="http://www.cnblogs.com/baiqiantao">张勇</a><p>
 * 创建时间：2020/5/30 15:36 <p>
 * 描述：
 *
 * @author zy
 */
public class Base1Render implements GLSurfaceView.Renderer {


    private Triangle triangle;
    private Square square;

    @Override
    public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) {
        gl10.glClearColor(0f, 1f, 0f, 1f);
        triangle = new Triangle();
        square = new Square();
    }

    @Override
    public void onSurfaceChanged(GL10 gl10, int width, int height) {
        gl10.glViewport(0, 0, width, height);
    }

    @Override
    public void onDrawFrame(GL10 gl10) {
        gl10.glClear(GLES20.GL_COLOR_BUFFER_BIT);
        triangle.draw();
    }
}
